package com.project.genesis.oss.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.project.genesis.entity.oss.FileInfo;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.UnknownHostException;

/**
 * <p>
 * 文件信息表 服务类
 * </p>
 *
 * @author qtx
 * @since 2022-09-26
 */
public interface FileInfoService extends IService<FileInfo> {

    /**
     * 上传文件
     *
     * @param file    文件
     * @param request http
     * @return 文件信息
     */
    FileInfo upload(MultipartFile file, HttpServletRequest request);

    /**
     * 保存文件信息
     *
     * @param file    文件
     * @param request http
     * @param uuid    id
     * @param otherId id
     * @return true or false
     */
    String saveNew(MultipartFile file, HttpServletRequest request, String uuid, String otherId) throws UnknownHostException;

    /**
     * 获取文件
     *
     * @param uuid     文件id
     * @param request
     * @param response
     */
    void getPlay(String uuid, HttpServletRequest request, HttpServletResponse response) throws IOException,
            ServletException;

    /**
     * 通过otherId逻辑删除
     *
     * @param otherId 其他信息id
     */
    void removeByOtherId(String otherId);
}
